<template>
	<view>
		<image v-if="addvImage" show-menu-by-longpress="true" :lazy-load="true" :lazy-load-margin="0" mode="widthFix"
			:src="`${app.imgUrl}${addvImage}`" class="btn-icon" @click="previewImage">
			</image>
		<!-- <image v-else show-menu-by-longpress="true" :lazy-load="true" :lazy-load-margin="0" mode="widthFix"
			src="../../static/proImage/wx.jpeg" class="btn-icon" @click="previewImage">
		</image> -->
	</view>
</template>

<script setup>
	import {
		ref,
		reactive,
		toRefs
	} from 'vue'
	import {
		onLoad
	} from '@dcloudio/uni-app'
	const app = getApp().globalData.utils
	const data = reactive({
		addvImage: ''
	})
	const {
		addvImage
	} = toRefs(data)
	onLoad(async options => {
		let aObj = JSON.parse(options.addvData)
		addvImage.value = aObj.effectContent
	})
	const previewImage = (e) => {
		uni.previewImage({
			// 需要预览的图片链接列表。若无需预览，可以注释urls
			urls: [e.target.src],
			// 为当前显示图片的链接/索引值
			current: 0,
			// 图片指示器样式	
			indicator: 'default',
			// 是否可循环预览
			loop: false,
			success: res => {
				console.log('previewImage res', res);
			},
			fail: err => {
				console.log('previewImage err', err);
			}
		});
	}
</script>

<style>
	view {
		width: 100%;
		text-align: center;
	}

	image {
		width: 100%;
	}
</style>